A device for measuring pressure, which is described in German Published Patent Application No. 100 14 992, for example, has a first sensor housing part, whose circumferential wall has a hexagonal shape, and a second sensor housing part which is provided with an electric terminal and is directly attached to the first sensor housing part. For this purpose, a groove, engaging the front face of a circumferential housing wall of the second sensor housing part, is cut into the first sensor housing part. The first housing part is flanged over the circumferential wall of the second sensor housing part in the area of the groove to fasten the first sensor housing part to the second sensor housing part.